All Questions
Tagged with javadesign-patterns
302 questions
4votes
2answers
520views
Simple Java program to aggregate lines of a text file
I have just written a small application to aggregate the lines of a text file, for example to group the lines according to the frequency of IP addresses in a log file. Would the code be sufficiently ...
0votes
1answer
62views
Bulk conditions evaluation throwing a single RuntimeException exception
Bulk conditions evaluation throwing a single exception of a configurable type for all unfulfilled conditions. It is developed around several design patterns: (1) fluent interface to configure the ...
1vote
1answer
88views
[Spring Boot][REST] Design Pattern Best Practice (Single Entity, multiple business logic implementations)
I have some problems regarding best-practice design between data source layer(Entity), domain layer(Service) and presentation layer (controller): I have one entity with a type field in the database to ...
4votes
1answer
104views
Sequentially bidirectional find the indexes of an element into a collection (after second thought)
The util class to find all the indexes on an element into a Collection supports forward and reverse lookup starting from a given index along with changing the ...
3votes
1answer
157views
Mail Client - Displaying email details for selected JTable Row
I'm trying to write a very simple IMAP email client in Java. There is one table per account with multiple multiline rows. The last selected row of one of the tables should be displayed in an extra ...
6votes
3answers
670views
Password checker using Decorator Pattern
I'm currently trying a Password checker for password in Decorator Pattern, which will point out what the current password missing to be a strong password (my example will check for 8 characters, at ...
3votes
1answer
229views
A library management system
Following is my code for a library management system. I am pretty new to OOD and trying to learn it. I am specially looking for ways where any design patterns can be useful here. I tried to make ...
2votes
0answers
63views
Implement Iterable where hasNext depends on mutable object state, which is mutated through explicit call
I am trying to implement the Iterable interface on an object, where the hasNext method on iterator will depend on mutable object state. This state is mutated by ...
-1votes
1answer
69views
Object build while sequential read user input [closed]
The implementation reads sequentially the user's input changing the type to build according to user choices. There are two main components a conditional structural sharing (...
3votes
1answer
104views
Sequentially find the indexes of an element into a collection
Util class to find into a collection the indexes of a given element with multiple occurrences from the first index or relative to a given index. ...
1vote
2answers
90views
Verification job with multiple type of batch verifiers
I have a use case where a verification batch job (non-generic) verifies domains based on its input e.g domain_type, batch_pointer etc. The verification handles it based on the domain type which uses ...
1vote
1answer
129views
Business logic verification template
I have a use case of template design pattern with generics as mentioned below. I have AbstractVerificationHandler that provides template for verification business ...
0votes
0answers
151views
Chain of Responsibility in the game of Hangman
I tried to do the Hangman Refactoring Kata for the piece of code over here - https://www.youtube.com/watch?v=-0MeoFTj6DU This is how the initial code looks like after first set of refactorings (i.e. ...
2votes
1answer
148views
Implement saga pattern with Kafka
There are very few example on how to implement saga pattern with Kafka so I tried to come up with my own implementation choreography saga pattern using Kafka. I need to implement outbox pattern as ...
1vote
1answer
2kviews
How to transform the CompletableFuture response
Context: I have a client app which consumes an API. I want to call this API is async way (using java.net.http.HttpClient) and once I receive this data then I want ...